

from pysql_helper import *



class test(object):

	def __init__(self,name,age,job):
		self.Id = 0
		self.Name = name
		self.Age = age
		self.Job = job


if __name__ == "__main__":

	helper = sql_helper(database="scrapy_spider",host="51try.top",port=3300,user="spider",password="123456")

	# kwargs 参数插入
	res = helper.insert("test",name="zhangsan",age=21, job="医生")
	print("kwargs 参数插入,执行成功：",res)

	#字典 参数插入
	dc1 = {"name":"lisi","age":22,"job":"教师"}
	res1 = helper.insert_dict("test",dc1)
	print("字典 参数插入,执行成功：",res1)

	#对象 参数插入
	dc2 = test('wangwu', 23, '软件工程师')
	res2 = helper.insert_obj(dc2)
	print("对象 参数插入,执行成功：",res2)

	print("-------------------------------------------------------------")

	is_exist = helper.is_exist_table("tt")
	print(is_exist)

	is_exist_col = helper.is_exist_column("tt","job")
	print(is_exist_col)

	print("-------------------------------------------------------------")


